﻿@model BTKERP.Model.RequisitionMaster
@{
    ViewBag.Title = "New Requistion";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section AdditionalJS
{
    <script type="text/javascript">

        $(function () {
            $("#requisitionDate,#deliveryDate").datepicker();
            // $("#btnSave").button();

            var errorMessage = '@ViewData["ErrorMessage"]';
            if (errorMessage.length > 0) {
                alert(errorMessage);
            }
        });

        function submitForm() {
            if ($("#reqCode").val().length == 0) {
                alert("Requision Code can not be empty!");
                return; 
            }

            $('#reqHeadForm').submit();
        }
    </script>

}
<h2>New Requisition</h2>
<fieldset>
<legend>Requisition Information</legend>
<form id="reqHeadForm" name="reqHeadForm" action="/Requistion/AddDetail" method="post">
<table class="editor W800">
    <tbody>
        <tr>
            <td class="right W200">
                Requision From 
            </td>
            <td class="left W300">
                @Html.DropDownList("fromHouse", ViewData["WareHouseLisst"] as IEnumerable<SelectListItem>, new { @class = "W200 Margin10" })
            </td>
             <td class="right W200">
                Requision To 
            </td>
            <td class="left W300">
                @Html.DropDownList("toHouse", ViewData["WareHouseLisst"] as IEnumerable<SelectListItem>, new { @class = "W200 Margin10" })
            </td>
        </tr>
        <tr>
            <td class="right">
                Requision Code
            </td>
            <td class="left">
                <input type="text" class="W200 Margin10" id="reqCode" name="reqCode" value=""/>
            </td>
            <td class="right">
                Delivery Date
            </td>
            <td class="left">
                <input type="text" class="W200 Margin10" id="deliveryDate" name="deliveryDate" value="@DateTime.Now.ToString("MM/dd/yyyy")" />
            </td>
        </tr>
        <tr>
            <td class="right">
                Requision Date
            </td>
            <td class="left">
                <input type="text" id="requisitionDate" name="requisitionDate" class="W200 Margin10" readonly="readonly" value="@DateTime.Now.ToString("MM/dd/yyyy")" />
            </td>
            <td class="right">
                Requision By
            </td>
            <td class="left">
                @Html.DropDownList("UserList",ViewData["UserList"] as IEnumerable<SelectListItem>,new { @class="W100 Margin10"})
                
            </td>
        </tr>
        <tr>
            <td class="right">
                Fulfilled Date
            </td>
            <td class="left">
                <input type="text" id="fullfilledDate" class="W200 Margin10" disabled="disabled" value="@DateTime.Now.ToString("MM/dd/yyyy")" />
            </td>
            <td class="right">
                Fulfilled By
            </td>
            <td class="left">
                <input type="text" class="W200 Margin10" disabled="disabled" value="@BTKERP.MVCWeb.AppCode.SessionHelper.Current.Staff.DisplayName"/>
            </td>
        </tr>   
        <tr>
            <td colspan="4" class="center">
                <input type="button" id="btnSave" class="btn btn-blue" value="Save" onclick=" submitForm();"/>
                <input type="button" value="Cancel" class="btn btn-red" onclick="$('#reqHeadForm')[0].reset();" />
            </td>
        </tr>  
    </tbody>
</table>
</form>
</fieldset>


